package com.example.demo.controller;

import org.springframework.web.bind.annotation.*;

/**
 * @describe: 类描述信息
 * @author: morningcat.zhang
 * @date: 2019/6/4 1:55 PM
 */
@RestController
public class HelloController {

    @RequestMapping("/hello")
    String sayHello() {
        return "Hello 仙女";
    }

    @RequestMapping("/person/{personId}")
    Person sayHello(@PathVariable("personId") Integer personId) {
        return Person.builder().id(personId).name("仙女").age(20).message("小仙女").build();
    }

    @PostMapping(value = "/person/create")
    public String createPerson(@RequestBody Person person) {
        System.out.println(person.getName() + "-" + person.getAge());
        return "Success, Person Id: " + person.getId();
    }
}
